<template>
  <view class="container">
    <!-- 标题 -->
    <view class="header">
      <img src="/static/标前信息.svg" />
      <text class="title">标前信息</text>
    </view>

    <!-- 标前信息内容 -->
    <view class="content">
      <!-- 登记编码 -->
      <view class="info-item">
        <text class="label">登记编码</text>
        <text class="value">{{ detailData.projectCode }}</text>
      </view>
      <!-- 项目名称 -->
      <view class="info-item">
        <text class="label">项目名称</text>
        <text class="value">{{ detailData.projectName }}</text>
      </view>

      <!-- 项目区域 -->
      <view class="info-item">
        <text class="label">项目区域</text>
        <text class="value">{{ detailData.projectArea }}</text>
      </view>

      <!-- 是否SM -->
      <view class="info-item">
        <text class="label">是否SM</text>
        <text class="value">{{ detailData.isSm }}</text>
      </view>

      <!-- 是否重大项目 -->
      <view class="info-item">
        <text class="label">是否重大项目</text>
        <text class="value">{{ detailData.isSignificantProject?'是':'否'}}</text>
      </view>
      <view v-if="isExpanded"> 
      <!-- 专业类型 -->
      <view class="info-item">
        <text class="label">专业类型</text>
        <text class="value">{{ detailData.professionalType }}</text>
      </view>

      <!-- 客户名称 -->
      <view class="info-item">
        <text class="label">客户名称</text>
        <text class="value">{{ detailData.clientName }}</text>
      </view>

      <!-- 客户类型 -->
      <view class="info-item">
        <text class="label">客户类型</text>
        <text class="value">{{ detailData.customerType}}</text>
      </view>

      <!-- 招标方式 -->
      <view class="info-item">
        <text class="label">招标方式</text>
        <text class="value">{{ detailData.biddingMethod }}</text>
      </view>

      <!-- 招标预算 -->
      <view class="info-item">
        <text class="label">招标预算（万元）</text>
        <text class="value">{{  detailData.biddingBudget }}</text>
      </view>

      <!-- 预计收入规模 -->
      <view class="info-item">
        <text class="label">预计收入规模（万元）</text>
        <text class="value">{{ detailData.revenueScale }}</text>
      </view>

      <!-- 预计毛利率 -->
      <view class="info-item">
        <text class="label">预计毛利率（%）</text>
        <text class="value">{{ detailData.estimateGrossMarginRate}}</text>
      </view>

      <!-- 预计招标时间 -->
      <view class="info-item">
        <text class="label">预计招标时间</text>
        <text class="value">{{ detailData.biddingTime }}</text>
      </view>

      <!-- I级赛道标签 -->
      <view class="info-item">
        <text class="label">I级赛道标签</text>
        <text class="value">{{ detailData.firstTrackLabel}}</text>
      </view>

      <!-- II级赛道标签 -->
      <view class="info-item">
        <text class="label">II级赛道标签</text>
        <text class="value">{{ detailData.secondTrackLabel }}</text>
      </view>

      <!-- 营销经理 -->
      <view class="info-item">
        <text class="label">营销经理</text>
        <text class="value">{{ detailData.marketingManager }}</text>
      </view>

      <!-- 营销经理所在部门 -->
      <view class="info-item">
        <text class="label">营销经理所在部门</text>
        <text class="value">{{ detailData.marketingManagerDept }}</text>
      </view>

      <!-- 项目概述 -->
      <view class="info-item">
        <text class="label">项目概述</text>
        <text class="value">{{ detailData.projectOverview }}</text>
      </view>
      <!-- 提交人 -->
      <view class="info-item">
        <text class="label">提交人</text>
        <text class="value">{{ submitter }}</text>
      </view>
    </view>
      <view class="feature-box" v-if="isExpanded" @click="toggleExpand">
        <text class="label">收起展示</text>
        <img src="/static/收起.svg" />
      </view>
      <view class="feature-box" v-else @click="toggleExpand">
        <text class="label">全部展开</text>
        <img src="/static/展开.svg" />
      </view>
    </view>

    <!-- 审核处理模块 -->
    <view class="header">
      <img src="/static/审核处理.svg" />
      <text class="title">审核处理</text>
    </view>
    <view class="audit-section">
      <!-- 当前审核环节 -->
      <view class="info-item">
        <text class="label">当前审核环节</text>
        <text class="value">{{ currentApprovalStep }}</text>
      </view>

      <!-- 当前环节审核结果 -->
      <view class="info-item">
        <text class="label">当前环节审核结果</text>
         <radio-group v-model="approvalResult" >
          <radio style="transform:scale(0.8)" value="1" :checked="approvalResult === '1'">审核通过</radio>
          <radio style="transform:scale(0.8)" value="0" :checked="approvalResult === '0'">审核不通过</radio>
         </radio-group>
      </view>

      <!-- 处理意见 -->
      <view class="info-item" style="display: block;">
        <text class="label">处理意见</text>
        <view> 
          <textarea maxlength="200" 
                    style="background-color: #EDF6FF;padding: 10px;
                            border-radius:10px;margin-top:10px;
                            height:80px
          "   
                      v-model="processingOpinion"  placeholder="请输入你的处理意见"/>
        </view>

      </view>

      <!-- 下个审核环节 -->
      <view class="info-item">
        <text class="label">下个审核环节</text>
        <text class="value">{{ nextApprovalStep }}</text>
      </view>

      <!-- 下个环节处理人 -->
      <view class="info-item">
        <text class="label">下个环节处理人</text>
        <text class="value">{{ nextApprovalPerson }}</text>
      </view>
    </view>
    <view class="footer">
        <view @click="cancel" class="footer-item-left">
         <text>取消</text>
        </view>
        <view class="footer-item-right">
          <img src="/static/打勾.svg"/>
          <text>确定</text>
        </view>
    </view>
  </view>
</template>

<script>
import { opportunityDetail } from '@/api/todo'
export default {
  data() {
    return {
      detailData:{},
      registrationCode: '2024122912090900',
      projectName: '湖南省教育厅关于采购招标代理服务的网上超市采购项目成交公告',
      projectArea: '中国-广东-广州市-天河区',
      isSM: 'MG1',
      isMajorProject: '贸易业务：信用交易金额≥3500万元（对方为非运营商集团客户）',
      professionalType: '供应链服务-招标服务-造价咨询',
      clientName: '中国电信',
      clientType: '电话运营商',
      biddingMethod: '公开投标招标',
      biddingBudget: '500000',
      expectedRevenue: '450000',
      grossMargin: '12%',
      expectedBiddingTime: '2025-1-12',
      firstLevelTag: '双碳',
      secondLevelTag: '老旧机楼改造、基站节能、绿色新能源、新能源电动车',
      marketingManager: '李四',
      marketingDepartment: '市场部',
      projectOverview: '湖南省教育厅关于采购招标代理服务的网上超市采购项目成交公告内容信息',
      submitter: '陈五五',
      isExpanded: true, // 控制是否展开
      currentApprovalStep: '业务单位内部审批', // 当前审核环节
      approvalResult: '0', // 当前环节审核结果
      processingOpinion: '', // 处理意见
      nextApprovalStep: '市场主管审批', // 下个审核环节
      nextApprovalPerson: '市场部-谢非非, 综合行政部-张杰杰' // 下个环节处理人
    };
  },
  mounted(){
    console.log(this.$route.query,'444444444')
    this.getDetail()

  },
  methods: {
    getDetail(){
      opportunityDetail({
        id:this.$route.query.id
      }).then(res=>{
        console.log(res,'444444444')
        this.detailData = res.data
      })

    },
    // 切换展开和收起
    toggleExpand() {
      this.isExpanded = !this.isExpanded;
    },
    cancel(){
      uni.navigateBack();
    }
  }
};
</script>

<style lang="scss" scoped>
/* 页面容器 */
.container {
  padding: 20px;
  background-color: #EDF6FF;
  min-height: 100vh;
  position: relative;
  padding-bottom: 90px;
}

/* 标题 */
.header {

  margin-bottom: 20px;
  img{
  vertical-align: middle;
  margin-right: 10px;
  }
}

.title {
  font-size: 18px;
  font-weight: bold;
  color: #333;
}

/* 展开按钮 */
.expand-btn {
  font-size: 14px;
  color: #007AFF;
  cursor: pointer;
}

/* 内容区域 */
.content {
  background-color: #fff;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
  padding-bottom: 0;
}

/* 审核处理模块 */
.audit-section {
  background-color: #fff;
  border-radius: 8px;
  padding: 15px;
}

.audit-section h2 {
  font-size: 16px;
  font-weight: bold;
  color: #333;
  margin-bottom: 15px;
}

/* 信息项 */
.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #eee;
  font-size: 14px;
}

.info-item:last-child {
  border-bottom: none;
}

/* 标签 */
.label {
  font-size: 14px;
  color: #889cac;
}

/* 值 */
.value {
  font-size: 14px;
  color: #333;
  text-align: right;
  max-width: 60%;
}

/* 输入框 */
.input {
  font-size: 14px;
  color: #333;
  text-align: right;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 5px;
  width: 60%;
}
.feature-box{
  height:48px;
  line-height: 48px;
  text-align: center;
  img{
    vertical-align: middle;
  }
}
.footer{
  position:fixed;
  bottom:0;
  left:0;
  right:0;
  height: 80px;
  background-color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  gap:0 20px;

  .footer-item-left{
    flex:1;
    text-align: center;
    line-height: 40px;
    background-color: #fff;
    background: #f4f6fa;
    border: 1px solid rgba(36,102,239,0.71);
    border-radius: 4px;
    color:#2466EF;
    box-sizing: border-box;
  }
  .footer-item-right{
    flex:3;
    text-align: center;
    line-height: 40px;
    background: linear-gradient(270deg,#689bff, #1257ea);
    border-radius: 4px;
    color:#fff;
    img{
      vertical-align:-3px;
      margin-right: 5px;
    }
  }
}
</style>